#include "ForceSearch.h"
#include <string.h>

int ForceSearch::SetUpData(int* pData, int iLen)
{
    if (m_pData)
    {
        delete m_pData;
    }
    m_iLen = iLen;

    m_pData = new int[iLen];
    if (NULL == m_pData)
    {
        return -1;
    }

    m_iLen = iLen;
    memcpy(m_pData, pData, sizeof(pData[0])*iLen);

    return 0;
}

int ForceSearch::Test(int iKey)
{
    for (int j = 0; j < m_iLen; ++j)
    {
        if (m_pData[j] == iKey)
        {
            return j;
        }
    }

    return 0;
}

